package de.karlNet.sambamanager.ldapController.commands;

import javax.naming.directory.BasicAttribute;
import javax.naming.directory.DirContext;
import javax.naming.directory.ModificationItem;

import org.springframework.stereotype.Component;

import de.karlNet.sambamanager.ldapModel.LdapGroup;
import de.karlNet.sambamanager.ldapModel.LdapNestable;

@Component
public class RemoveMembership extends BaseCommand {
	public void removeNestableFromGroup(LdapGroup groupToBeRemovedFrom,
			LdapNestable member) {
		ModificationItem modificationItems[] = { new ModificationItem(
				DirContext.REMOVE_ATTRIBUTE, new BasicAttribute("member",
						member.getDn())) };
		this.ldapTemplate.modifyAttributes(groupToBeRemovedFrom.getDn(),
				modificationItems);
	}
}
